package com.smart.community.feign.device;

import com.smart.community.feign.device.fallback.DeviceStatisticsFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 设备统计Feign接口
 * 提供设备在线率统计相关的远程调用接口
 * 
 * @author Wu.Liang
 * @version 1.0.0
 * @since 2025-01-30
 */
@FeignClient(
    name = "smart-community-device",
    path = "/feign/device",
    fallbackFactory = DeviceStatisticsFeignFallbackFactory.class,
    contextId = "deviceStatisticsFeign"
)
public interface IDeviceStatisticsFeign {
    
    /**
     * 根据社区ID列表获取设备在线率
     * 
     * @param communityIds 社区ID列表
     * @return 设备在线率（百分比）
     */
    @PostMapping("/statistics/online-rate/by-communities")
    Double getDeviceOnlineRateByCommunityIds(@RequestBody List<Long> communityIds);
    
    /**
     * 根据物业公司ID列表获取设备在线率
     * 
     * @param propertyCompanyIds 物业公司ID列表
     * @return 设备在线率（百分比）
     */
    @PostMapping("/statistics/online-rate/by-property-companies")
    Double getDeviceOnlineRateByPropertyCompanyIds(@RequestBody List<Long> propertyCompanyIds);
}
